package com.ruix.app.mapper;

import com.ruix.app.model.PostsCard;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;

/**
 * Created by hadexs on 2017/4/19.
 */

public class PostCardMapper implements ApiMapper<PostsCard> {


    @Override
    public PostsCard transform(JSONObject response) {
        JSONObject data = response.optJSONObject("data");
        if (data != null) {
            JSONObject postObject = data.optJSONObject("post");
            if (postObject != null) {
                PostsCard postsCard = new PostsCard().parse(postObject);
                return postsCard;
            }
        }
        return null;
    }
}
